package com.sara.util;

import java.util.List;

public class Page<T> {
    //当前页码
    private Integer pageNo;

    //起始行
    private Integer start;

    //每页数量
    private Integer PageSize = 5;
    //总页数
    private Integer totlePage;

    //当前页内容
    private List<T> tList;

    public List<T> gettList() {
        return tList;
    }

    public void settList(List<T> tList) {
        this.tList = tList;
    }



    public Page(int pageNo, int count){
        Integer totlePage = count/this.PageSize;
        totlePage = (count % this.PageSize) == 0 ? totlePage : ++totlePage;
        pageNo = pageNo < totlePage ? pageNo : totlePage;
        pageNo = pageNo < 1 ? 1: pageNo;

        this.start =  (pageNo - 1) * this.PageSize;
        this.pageNo = pageNo;
        this.totlePage = totlePage;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Integer getStart() {
        return start;
    }

    public void setStart(Integer start) {
        this.start = start;
    }

    public Integer getPageSize() {
        return PageSize;
    }

    public void setPageSize(Integer pageSize) {
        PageSize = pageSize;
    }

    public Integer getTotlePage() {
        return totlePage;
    }

    public void setTotlePage(Integer totlePage) {
        this.totlePage = totlePage;
    }






}
